<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<style>
		body {
			background: #f8f8f8;
			color: #222;
		}
		#sx-view{
			padding-bottom: 1rem;
			margin-bottom: 1rem;
		}
		.li{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 0.75rem;
			background: #fff;
			padding: 0.75rem;
			position: relative;
		}
		.li .l{
			margin-right: 3rem;
			position: relative;
		}
		.li .text{
			display: flex;
			justify-content: flex-start;
			align-items: center;
			padding-bottom: 0.35rem;

		}
		.li .xingming{
			font-size: 0.85rem;
		}
		.li .mobile{
			font-size: 0.65rem;
			color: #777;
			padding: 0 0.35rem;
		}
		.li .dizhi{
			font-size: 0.65rem;
		}
		.li .moren,.li .tags{
			background: #FE2C55;
			font-size: 0.55rem;
			color: #fff;
			padding: 0.1rem 0.25rem;
			border-radius: 0.15rem;
		}
		.li .tags{
			margin-left: 0.35rem;
			background: #f7e6e6;
			color: #FE2C55;
		}
		.li .r{
			position: absolute;
			right: 0;
			top: 0;
			bottom: 0;
			/*background: #ddd;*/
			width: 3rem;
			height:100%;
			padding-top: 1.5rem;
		}
		.li .r img{
			width: 1rem;
			height: 1rem;
			margin: 0 auto;
			text-align: center;
		}
		#sx-header{
			/*background: #fff !important;*/
		}

		.aui-btn img {
			width: 0.75rem;
		}

		.aui-title {
			/*color: #222;*/
		}

		.footer {
			position: fixed;
			left: 0;
			bottom: 0;
			width: 100%;
			margin-bottom: 1rem;
		}
		.footer .tijiao{
			margin: 0 0.75rem;
			background: #FE2C55;
			color: #fff;
			border-radius: 0.15rem;
			padding: 0.5rem 0rem;
			font-size: 0.75rem;
			text-align: center;
		}
		.meiyoushju{
			color: #999 !important;
		}
	</style>
</head>

<body>
	<!-- <header class="aui-bar aui-bar-nav" id="sx-header">
		<a class="aui-pull-left aui-btn" tapmode onclick="_close()"><img src="../i/x.png" /></a>
		<div class="aui-title">收货地址</div>
	</header> -->
	<script id="sx-list" type="text/x-dot-template">
		{{ for(var i=0,it=it.data; i < it.length; i++) { }}
		<div class="li">
			<div class="l" tapmode onclick="xuanze(this)" data-data='{{= JSON.stringify(it[i])}}'>
				<div class="text">
					<div class="xingming">{{= it[i].xingming}}</div>
					<div class="mobile">{{= it[i].mobile}}</div>
					{{? it[i].moren }}
					<div class="moren">默认</div>
					{{?}}
					{{? it[i].tags }}
					<div class="tags">{{= it[i].tags}}</div>
					{{?}}
				</div>
				<div class="dizhi">
					{{= it[i].diqu}}{{= it[i].dizhi}}
				</div>
			</div>
			<div class="r" tapmode onclick="_url({id:{{= it[i].id}},animation:true},'shop_dizhi_add')"><img src="../i/shop/edit.png"></div>
		</div>
		{{ } }}
	</script>
	<div class="aui-content" id="sx-view"><div id="jiazai" style="padding-top:50%;"><img src="../i/loading_more.gif" /></div></div>
	<div class="footer">
		<div class="tijiao" tapmode onclick="_url({animation:true},'shop_dizhi_add')">
			添加地址
		</div>
	</div>
</body>

<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	apiready = function() {
		// header = $api.byId('sx-header');
		// $api.fixStatusBar(header);
		api.parseTapmode();
		$api.fixTabBar($api.dom('.footer'))
		url = 'shop/dizhi';
		_list({url:url,loading:1});
		// 监听滚动
		api.addEventListener({
			name : 'scrolltobottom',
			extra : {
				threshold : 100 //设置距离底部多少距离时触发，默认值为0，数字类型
			}
		}, function(ret, err) {
			if (heigutgao == 1) {// heigutgao=1开启执行 0停止执行   防止连续滚动，等加载数据之后在进行滚动。
				pagenum += 1
				_list({url:url,page:pagenum});
			}
		});
		// api.addEventListener({
		// 	name: 'viewappear'
		// }, function(ret, err) {
		// 	_list({url:url,loading:1});
		// });
	}
	function shuaxin(){
		_list({url:url,loading:1});
	}
	function xuanze(_this){
		if(!api.pageParam['xuanze']){
			return;
		}
		var data = $(_this).data('data');
		api.execScript({
		    name: 'shop_pay',
		    script: 'dizhi(\''+JSON.stringify(data)+'\');'
		});
		_close();
	}
</script>
</html>
